home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / polygo / poly.txt next >
Encoding:
Text File  |  1992-01-05  |  2.3 KB  |  50 lines

  1.      PolyGone is a VB app with no redeeming value... it's just
  2. fun to have it on the desktop.  All it does is draw polygons
  3. with connected vertices in various sizes and colors.  It tracks
  4. the size of the form it's on, and adjusts the size and maximum
  5. number of vertices (the "order" of the polygon) accordingly. 
  6. It's very easy on resources, and it's even fun when minimized!
  7.  
  8.      The basic polygon drawing routine has been around for
  9. several (at least 15) years, and I can't properly credit the
  10. original source.  I modified it enough that it hardly matters.
  11.  
  12.      All of the real action takes place in the routine "Outer",
  13. which loops choosing a current color, H and V offset, overall
  14. size and polygon order.  These are chosen by using scaled random
  15. numbers so that the results are reasonable given the current
  16. window size and shape.  The routine will occasionally "wipe out"
  17. the accumulated images on its own by drawing a large and dense
  18. polygon in the background color and then clearing the window. 
  19. You can force the window to clear after the current polygon is
  20. drawn by clicking anywhere in the window.
  21.  
  22.      The grunt work takes place in the routine DrawPoly, which
  23. does what its name implies.  The code is a horrible mishmash of
  24. local and global variables, etc, but it's so simple it didn't
  25. warrant any more elaboration.
  26.  
  27.      The routine "ReScale" is invoked in the Load and Resize
  28. event procedures, and makes some arbitrary decisions about how
  29. large the polygons should get (they're ranged when drawn), and
  30. what the maximum vertex count should be... too many vertices and
  31. the polygons all look like solid circles and take very long to
  32. draw; too few and they're difficult to distinguish.
  33.  
  34.      I converted this from a QB version in about 10 minutes, to
  35. show my son how easily some things can be ported to VB, and it
  36. just worked.  Putting the VB-specific code in place took another
  37. hour or so, and then a couple days of just watching it perform
  38. off to the side and tweaking the internal "factors".
  39.  
  40.      This program isn't copyrighted........ feel free to adapt
  41. it as you see fit.  I'd appreciate it if you'd send me a copy of
  42. anything you produce with this as a starting point.  Enjoy!
  43.  
  44.  
  45.      -- Jim Mack
  46.         CIS 76630,2012
  47.         Editing Services Co
  48.         PO Box 599
  49.         Plymouth, MI 48170
  50.